home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
games_de
/
ds100p2.zip
/
SETUP.RUL
< prev
next >
Wrap
Text File
|
1996-04-14
|
11KB
|
343 lines
/*-----------------------------------------------------------------------------
Descent Studio Installation Script
------------------------------------------------------------------------------*/
#define SIZE_REQ_PROGRAM 500000
#define APP_NAME "Descent Studio Pre-Release 2"
#define PROGRAM_GROUP_NAME "Descent Studio Pre-Release 2"
#define APPBASE_PATH "JeffFerguson@msn.com\\Descent Studio Pre-Release 2\\"
#define COMPANY_NAME "JeffFerguson@msn.com"
#define PRODUCT_NAME "Descent Studio Pre-Release 2"
#define PRODUCT_VERSION "1.0.0"
#define PRODUCT_KEY "Descent Studio.exe"
#define UNINSTALL_KEY "Descent Studio Pre-Release 2"
#define APPBASE_DIR95 "Program Files"
#define PROGRAM_FILENAME "Descent Studio.exe"
#define HELP_FILENAME "Descent Studio.hlp"
#define STR_COMPLETE95 "by selecting the program icon in the Programs menu.\n\n"
#define STR_COMPLETENT "by selecting the program icon in the program group.\n\n"
declare
// global variable declarations
STRING svGrp;
STRING szMsg;
STRING szFileSet;
STRING szTitle;
STRING szAppPath;
STRING szAppSharedDir;
STRING szHelp;
STRING szProgram;
STRING szTemp;
STRING svUninstLogFile;
STRING szRegKey;
STRING svMainDirectory[_MAX_STRING];
BOOL bSpaceOk;
BOOL bReshowSetupType;
NUMBER nResult;
NUMBER nStatusId;
NUMBER nType;
BOOL bIncludeProgram;
BOOL bIncludeSamples;
BOOL bIncludeHelp;
BOOL bWinNT;
BOOL bWin95;
// function declarations
prototype SetupScreen();
prototype CheckRequirements();
prototype CheckSpaceRequirements( number, number, number, string );
prototype CreateRegDBEntries();
program
StartHere:
Disable(BACKGROUND);
// Set up the installation screen.
SetupScreen();
// Set installation info., which is required for registry entries.
InstallationInfo(COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY);
// Create a Welcome dialog.
WelcomeDlg:
Disable(BACKBUTTON);
Welcome("", 0);
Enable(BACKBUTTON);
// Test target system proper configuration.
CheckRequirements();
// Ask user for a destination location for the installation.
GetTargetDirectory:
svMainDirectory = TARGETDISK ^ APPBASE_DIR95 ^ APPBASE_PATH;
szMsg = "";
if (AskDestPath("", szMsg, svMainDirectory, 0) = BACK) then
goto WelcomeDlg;
endif;
szAppSharedDir = svMainDirectory ^ "System";
FolderSelection:
svGrp = PROGRAM_GROUP_NAME;
// Allow user to modify folder name.
if(SelectFolder("", svGrp, svGrp) = BACK) then
goto GetTargetDirectory;
endif;
FileTransferSetup:
// Prepare InstallShield to record deinstallation information.
DeinstallStart(svMainDirectory, svUninstLogFile, UNINSTALL_KEY, 0);
RegDBSetItem(REGDB_UNINSTALL_NAME, APP_NAME);
// Set registry App Paths key information for the main application.
szAppPath = svMainDirectory + ";" + szAppSharedDir;
RegDBSetItem(REGDB_APPPATH, szAppPath);
szProgram = svMainDirectory ^ PROGRAM_FILENAME;
RegDBSetItem(REGDB_APPPATH_DEFAULT, szProgram);
// Define the "General" file set.
szFileSet = "General";
TARGETDIR = svMainDirectory;
FileSetBeginDefine(szFileSet);
TARGETDIR = svMainDirectory;
CompressGet("program.z", "*.*", COMP_NORMAL);
TARGETDIR = szAppSharedDir;
CompressGet("system.z", "*.*", COMP_NORMAL);
FileSetEndDefine(szFileSet);
DoFileTransfer:
// Set up progress indicator and information gauge.
Enable(STATUSDLG);
Enable(INDVFILESTATUS);
SetStatusWindow(0, "Copying program files..." );
StatusUpdate(ON, 100);
// Perform the file set.
nResult = FileSetPerformEz(szFileSet, 0);
switch (nResult)
case FS_DONE: // Successful completion.
case FS_CREATEDIR: // Create directory error.
MessageBox("Unable to create a directory under " + TARGETDIR + ". Please check write access to this directory.", SEVERE);
abort;
default: // Group all other errors under default label.
NumToStr(szTemp, nResult);
MessageBox( "General file transfer error. Please check your target location and try again.\n\n Error Number:"+szTemp, SEVERE);
abort;
endswitch;
SetRegistryEntries:
CreateRegDBEntries();
Delay(2);
Disable(STATUSDLG);
// Create program groups (folders) and icons.
CreateFolderIcons:
SetStatusWindow(100, "Creating Folder and Icons...." );
CreateProgramFolder(svGrp);
LongPathToShortPath(svMainDirectory);
Delay(1);
TARGETDIR = svMainDirectory;
szProgram = TARGETDIR ^ PROGRAM_FILENAME;
if(bWin95 = TRUE) then
LongPathToQuote(szProgram, TRUE);
endif;
if(bWinNT = TRUE) then
LongPathToShortPath(szProgram);
endif;
AddFolderIcon(svGrp, APP_NAME, szProgram, TARGETDIR, "", 0, "", REPLACE);
Delay(1);
szHelp = szAppSharedDir ^ HELP_FILENAME;
if(bWin95 = TRUE) then
LongPathToQuote(szHelp, TRUE);
LongPathToQuote(szAppSharedDir, TRUE);
endif;
if(bWinNT = TRUE) then
LongPathToShortPath(szHelp);
LongPathToShortPath(szAppSharedDir);
endif;
AddFolderIcon(svGrp, APP_NAME + " Help", szHelp, szAppSharedDir, "", 0, "", REPLACE);
Delay(1);
szProgram = WINDIR ^ "UNINST.EXE";
LongPathToShortPath(svUninstLogFile);
AddFolderIcon(svGrp, "Remove " + APP_NAME, szProgram + " -f" + svUninstLogFile, WINDIR, "", 0, "", REPLACE);
Delay(1);
// Announce setup complete and offer to read README file.
SetStatusWindow(100, "Installation complete.");
szMsg = "Setup is complete. You may run the installed program ";
if(bWinNT = TRUE) then
szMsg = szMsg + STR_COMPLETENT;
else
szMsg = szMsg + STR_COMPLETE95;
endif;
MessageBeep(0);
MessageBox(szMsg, INFORMATION);
exit;
/*---------------------------------------------------------------------------*\
*
* Function: SetupScreen
*
* Purpose: This function will set up the screen look. This includes
* colors, fonts, text to be displayed, etc.
*
*
* Input:
*
* Returns:
*
* Comments:
\*---------------------------------------------------------------------------*/
function SetupScreen()
begin
Enable(INDVFILESTATUS);
SetTitle(APP_NAME + " Setup", 24, WHITE);
SetTitle("Setup", 0, BACKGROUNDCAPTION); // Caption bar text.
Enable(BACKGROUND);
end;
/*---------------------------------------------------------------------------*\
*
* Function: CheckRequirements
*
* Purpose: This function will check all minimum requirements for the
* application being installed. If any fail, then the user
* is informed and the installation is terminated.
*
*
* Input:
*
* Returns:
*
* Comments:
\*---------------------------------------------------------------------------*/
function CheckRequirements()
number nvDx;
NUMBER nvDy;
number nvResult;
STRING szResult;
begin
// Determine if target system uses NT or Windows 95.
GetSystemInfo( WINMAJOR, nvResult, szResult );
bWin95 = TRUE;
bWinNT = FALSE;
if (nvResult = 4) then
bWinNT = FALSE; // Running Windows 95.
bWin95 = TRUE;
endif;
// Check screen resolution.
GetExtents( nvDx, nvDy );
if (nvDy < 480) then
MessageBox( "This program requires VGA or better resolution.", WARNING );
exit;
endif;
end;
/*---------------------------------------------------------------------------*\
*
* Function: CheckSpaceRequirements
*
* Purpose: This function will check space requirements based on the
* elements being installed.
*
* Input:
*
* Returns:
*
* Comments:
\*---------------------------------------------------------------------------*/
function CheckSpaceRequirements( bIncludeSamples,
bIncludeProgram,
bIncludeHelp,
szDir )
number nSizeRequired;
begin
nSizeRequired = SIZE_REQ_PROGRAM;
// Check space on target drive.
bSpaceOk = TRUE;
if (GetDiskSpace( szDir ) < nSizeRequired) then
szMsg = "There is not enough space available on the disk\n" +
"'" + svMainDirectory + "' \n" +
"Please free up some space or change the target location\n" +
"to a different disk";
MessageBeep(0);
MessageBox( szMsg, WARNING );
bSpaceOk = FALSE;
endif;
return bSpaceOk;
end;
/*----------------------------------------------------------------------------
CreateRegDBEntries()
Creates main Registry keys for Descent Studio. Only the main keys need to be
created. Descent Studio will fill in missing keys when it exits and the
uninstallation will delete the keys added here and everything beneath them.
The main keys are created here so that the uninstallation will know to remove
the keys from the Registry.
Note that one of the keys reads "Descent.HOG.File". This is probably wrong;
the OLE Automation document will be a Descent Studio-specific document. The
key will probably be something like "Descent.Studio.Document". This is unused
now, so we won't worry about it. We'll just make sure that it gets logged for
an undeletion.
-----------------------------------------------------------------------------*/
function CreateRegDBEntries()
begin
RegDBSetDefaultRoot(HKEY_CLASSES_ROOT);
RegDBCreateKeyEx("CLSID\\{C2C51BAC-631E-11CF-9C28-444553540000}", "");
RegDBCreateKeyEx("Descent.HOG.File", "");
RegDBSetDefaultRoot(HKEY_CURRENT_USER);
RegDBCreateKeyEx("Software\\JeffFerguson@msn.com\\Descent Studio", "");
end;